<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="x-ua-compatible" content="ie=7" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="<%=path%>/css/main.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/dialog.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css" />
		<script language="javascript" type="text/javascript" src="<%=path%>/js/include.js"></script>
		<script language="javascript" type="text/javascript" src="<%=path%>/calendar/WdatePicker.js"></script>
		<script language="JavaScript" type="text/javascript" src="<%=path%>/js/caltimer.js"></script>
	</head>

	<body class="fullbody">
				<div class="context">
					<div class="position">
						<div class="tposi">
							当前位置：
							<a href="javascript:changeMenu(1,'<%=request.getContextPath()%>/infopub/pubmain?menuid=1');" class="linkstyle">首页</a>&nbsp;&gt;&gt;&nbsp;
							<a href="javascript:changeMenu(4,'')" class="linkstyle">自助服务</a>&nbsp;&gt;&gt;&nbsp;
							<span class="curposition">产品分类管理</span>
						</div>
						<div class="help">
							<a href="javascript:void(null);" onclick="doHelp('<%=request.getContextPath()%>/help/html/CPMUGL.html');" class="linkstyle">帮助</a>
						</div>
					</div>
					<div class="margin8"></div>
					<div class="subpage_title">
						<div class="title_index">
							<img src="<%=path%>/images/common/dot03.gif" alt="" border="0" />
							&nbsp;产品分类管理
						</div>
						<div class="rollback">
							<a href="javascript:changeMenu(4,'');" class="linkstyle">&lt;&lt;&nbsp;返回自助服务</a>
						</div>
					</div>
					<div class="margin20"></div>
					<form action="<%=path%>/selfinfo/submitproduct" method="post">
						<div class="productlist">
							<div><b>产品信息</b></div>
							<div class="margin10"></div>
							<div class="spliter_line"></div>
							<div class="margin10"></div>
							<div>
								<table border="0" cellpadding="0" cellspacing="0" id="prodList"
									class="subpage_table1 withborder2" align="center" width="800">
									<tr align="center">
										<th class="w_04">序号</th>
										<th class="w_02">产品分类名称</th>
										<th class="w_02">产品用途</th>
										<th class="w_02">产能(年)</th>
										<th class="w_02">主要材料来源</th>
										<th class="w_02">供货周期</th>
										<th class="w_02">备注(请补充注明：市场占有率、主要客户级业绩、可供余量、主要设备、可信竞争力)</th>
										<th class="list_text_1" >操作</th>
									</tr>
									<c:if test="${productType!=null}">
										<c:forEach items="${productType}" var="product"
											varStatus="index" >
											<tr align="center" id="${product.pkProdCl}">
												<td>${index.count}</td>
												<td>
													<input type='text' class='list_text_2' name='name' id='${product.pkProdCl}-name' value='${product.name}' readOnly/>
													<input type="hidden"   name='prodclrank'  value='${product.prodclrank}' />
													<input type="hidden"   name='status'  value='${product.prodclstatus}' />
													<input type="hidden"   name='validdate'  value='${product.date}' />
												</td>
												<td>
													<input type='text' class='list_text_2' name='prod_app' id='prod_app' value='${product.prod_app}'/> 
												</td>
												<td>
													<input type='text' class='list_text_2' name='prod_output' id='prod_output' value='${product.prod_output}'/> 
												</td>
												<td>
													<input type='text' class='list_text_2' name='prod_material' id='prod_material' value='${product.prod_material}'/> 
												</td>
												<td>
													<input type='text' class='list_text_2' name='prod_cycle' id='prod_cycle' value='${product.prod_cycle}'/> 
												</td>
												<td>
													<input type='text' class='list_text_2' name='prod_memo' id='prod_memo' value='${product.prod_memo}'/> 
												</td>
												<td class="w_04">
													<a href="javascript:deleteRowById('${product.pkProdCl}')" class="linkstyle3">删除</a>
													<input type="hidden" name="pkProdCl" value="${product.pkProdCl}" />
												</td>
											</tr>
										</c:forEach>
									</c:if>
								</table>
								<table border="0" cellpadding="0" cellspacing="0" 
									class="subpage_table1 withborder2" align="center" width="800">
									<tr>
										<td colspan="9">
											&nbsp;
											<img alt="" src="<%=path%>/images/common/add.png" border="0" />
											&nbsp;
											<a href="javascript:showDialog('添加产品分类','add','${size}');"
												class="linkstyle3">添加新的产品分类</a>
										</td>
									</tr>
								</table>
							</div>
							<div class="margin8"></div>
							<div class="buttonrow">
								<input type="submit" class="buttonok" value="提交" />
								&nbsp;&nbsp;&nbsp;&nbsp;
							</div>
							
							<div class="margin20"></div>
							<div id="message" class="msgcolor">
								<c:out value="${system_err_msg}" />
							</div>
						</div>
					</form>
				</div>
			<div class="margin20"></div>
<!--		</div>-->
		
		<script language="javascript">
			function showDialog(title,type,index){
				var url = "url:post?<%=path%>/selfinfo/editproduct?type="+type+"&index="+index;
				dialog(title, url,"500", "auto", "","");
			}
			//修改行
			function editRowById(pkCl){
				var iframe="iframe:<%=path%>/selfservice/selfservice/product.jsp?pkCl="+pkCl;
				dialog("产品分类修改",iframe,"500","250","","");
			}
			//删除行
			function deleteRowById(pkCl) {
				var root = document.all("prodList");
				var rows = root.rows;
				//寻找到对应的删除行并进行删除
				for(var pos = 1; pos < rows.length; pos++) {
					var temprow = rows[pos];
					if(temprow.id == pkCl) {
						root.deleteRow(pos);
						break;
					}
				}
				//当删除行操作时更新显示索引
				//当删除行操作时更新显示索引
				for(var pos = 1; pos < rows.length; pos++) {
					var temprow = rows[pos];
					var cells = temprow.cells;
					var cell = cells[0];
					if(typeof(cell) == 'object') {
						cell.innerHTML = pos;
					}
				}	 
			}
		</script>
	</body>
</html>
